#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int count = 5;
    vector<int> arr(count);
    for (int i = 0;i < count;i++)
        cin >> arr[i];
    sort(arr.begin(), arr.end());
    cout << arr[arr.size() - 1] << " " << arr[arr.size() - 2];
}